/**
 * Copyright 2004 - 2007 Blue Bamboo International Inc. 
 *           All rights reserved.
 *
 *
 * Blue Bamboo PROPRIETARY/CONFIDENTIAL.
 *
 */

package com.bluebamboo.bluetools.pingpang.bean;

import org.apache.mina.core.service.IoHandler;

import com.bluebamboo.bluetools.pingpang.connection.IConnectionHandler;
import com.bluebamboo.bluetools.pingpang.connection.SerialConnectionHandler;

/**
 * DOCME
 * 
 * @author tanxuqing
 * @date Sep 12, 2009
 * @since
 */
public class SerialBean extends ConnectionBean {

    private String port;

    private int baudRate;
    private int stopBits;
    private int dataBits;
    private int parity;
    private int flowControlMode;

    /**
     * @param name
     */
    public SerialBean(String name) {
        super(name, TYPE_SERIAL);
    }

    /**
     * @param name
     * @param port
     * @param baudRate
     * @param stopBits
     * @param dataBits
     * @param parity
     * @param flowControlMode
     */
    public SerialBean(String name, String port, int baudRate, int stopBits, int dataBits, int parity,
            int flowControlMode) {
        super(name, TYPE_SERIAL);
        this.port = port;
        this.baudRate = baudRate;
        this.stopBits = stopBits;
        this.dataBits = dataBits;
        this.parity = parity;
        this.flowControlMode = flowControlMode;
    }

    /**
     * @return the port
     */
    public String getPort() {
        return port;
    }

    /**
     * @param port the port to set
     */
    public void setPort(String port) {
        this.port = port;
    }

    /**
     * @return the baudRate
     */
    public int getBaudRate() {
        return baudRate;
    }

    /**
     * @param baudRate the baudRate to set
     */
    public void setBaudRate(int baudRate) {
        this.baudRate = baudRate;
    }

    /**
     * @return the stopBits
     */
    public int getStopBits() {
        return stopBits;
    }

    /**
     * @param stopBits the stopBits to set
     */
    public void setStopBits(int stopBits) {
        this.stopBits = stopBits;
    }

    /**
     * @return the dataBits
     */
    public int getDataBits() {
        return dataBits;
    }

    /**
     * @param dataBits the dataBits to set
     */
    public void setDataBits(int dataBits) {
        this.dataBits = dataBits;
    }

    /**
     * @return the parity
     */
    public int getParity() {
        return parity;
    }

    /**
     * @param parity the parity to set
     */
    public void setParity(int parity) {
        this.parity = parity;
    }

    /**
     * @return the flowControlMode
     */
    public int getFlowControlMode() {
        return flowControlMode;
    }

    /**
     * @param flowControlMode the flowControlMode to set
     */
    public void setFlowControlMode(int flowControlMode) {
        this.flowControlMode = flowControlMode;
    }

    @Override
    public IConnectionHandler createConnectionHandler() {
        return new SerialConnectionHandler(this);
    }

    @Override
    public IoHandler createIoHandler() {
        // TODO Auto-generated method stub
        return null;
    }

}
